﻿<Page x:Class="Probel.Ldoc.Views.Pages.PatientEditorView"
      
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:conv="clr-namespace:Probel.Ldoc.Views.Converters"
      xmlns:t="clr-namespace:Probel.Ldoc.Views.Properties"
      xmlns:ctrl="clr-namespace:Probel.Ldoc.Views.Controls"
      xmlns:views="clr-namespace:Probel.Ldoc.Views.Pages"
      xmlns:tk="http://schemas.xceed.com/wpf/xaml/toolkit"
      xmlns:self="clr-namespace:Probel.Ldoc.Views.Pages"
             
      mc:Ignorable="d" d:DesignWidth="1024" d:DesignHeight="947"
      Background="{x:Null}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary>
                    <conv:StatusToImageConverter x:Key="statusToImage"/>
                    <conv:BytesToImageConverter x:Key="bytesToImage"/>
                    <conv:BirthdateToAgeConverter x:Key="birthdateToAge"/>
                    <conv:DateTimeToStringConverter x:Key="dateTimeToString"/>
                    <BooleanToVisibilityConverter x:Key="boolToVisibility"/>

                    <Style TargetType="TextBox">
                        <Setter Property="Margin" Value="5"/>
                    </Style>
                    <Style TargetType="TextBlock" x:Key="TextBoxStyle">
                        <Setter Property="Margin" Value="5"/>
                        <Setter Property="FontSize" Value="12"/>
                        <Setter Property="VerticalAlignment" Value="Center"/>
                        <Setter Property="Width" Value="100"/>
                        <Setter Property="TextAlignment" Value="Right"/>
                    </Style>
                    <Style TargetType="ComboBox">
                        <Setter Property="Margin" Value="5"/>
                    </Style>
                </ResourceDictionary>
                <ResourceDictionary Source="../Themes/Generic.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Page.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Save"
                        Executed="SaveCommand_Executed"
                        CanExecute="SaveCommand__CanExecute"/>
        <CommandBinding Command="{x:Static self:PatientEditorView.UndoCommand}"
                        Executed="UndoCommand_Executed"
                        CanExecute="UndoCommand_CanExecute"/>
    </Page.CommandBindings>
    <DockPanel>
        <StatusBar DockPanel.Dock="Bottom" Background="#FF465A7D">
            <StatusBarItem>
                <DockPanel>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding UiMessage, Converter={StaticResource statusToImage}}" 
                           Width="16" 
                           Height="16" 
                           Margin="0,0,5,0"/>
                        <TextBlock Text="{Binding UiMessage.Message}"/>
                    </StackPanel>
                </DockPanel>
            </StatusBarItem>
            <StatusBarItem HorizontalAlignment="Right">
                <TextBlock>
                    <Run Text="{x:Static t:Messages.Status_Patient}"/>
                    <Run Text="{Binding CurrentPatientName,Mode=OneWay}"/>
                </TextBlock>
            </StatusBarItem>
        </StatusBar>
        <HeaderedContentControl Header="Patient editor">
            <DockPanel LastChildFill="True">
                <Border DockPanel.Dock="Top"
                        Height="Auto">
                    <ToolBar x:Name="mainToolbar"
                             ToolBarTray.IsLocked="True"
                             Height="27">
                        <Button Command="ApplicationCommands.Save"
                                ToolTip="{x:Static t:Messages.Action_Save}">
                            <Image Source="/Probel.Ldoc.Views;component/Images/Save.png"/>
                        </Button>
                        <Button Command="{x:Static self:PatientEditorView.UndoCommand}"
                                ToolTip="{x:Static t:Messages.Action_Undo}">
                            <Image Source="/Probel.Ldoc.Views;component/Images/Editing/Arrow_Undo.png"/>
                        </Button>
                        <Button ToolTip="{x:Static t:Messages.Action_AddDoctor}"
                                Click="Click_CreateDoctor">
                            <Image Source="/Probel.Ldoc.Views;component/Images/User.png"/>
                        </Button>
                    </ToolBar>
                </Border>
                <Grid DockPanel.Dock="Bottom">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <DockPanel>
                        <Border DockPanel.Dock="Top" 
                            BorderThickness="5"
                            CornerRadius="5"
                            Background="#FF465A7D"
                            Height="250" 
                            HorizontalAlignment="Stretch"                
                            VerticalAlignment="Top"
                            Margin="0,0,0,0">
                            <Border.Effect>
                                <DropShadowEffect Color="#FFB6B6B6"/>
                            </Border.Effect>
                            <HeaderedContentControl Header="{x:Static t:Messages.Gb_Photo}">
                                <DockPanel>
                                    <TextBlock DockPanel.Dock="Bottom"                                    
                                   Margin="0,5,0,0" 
                                   HorizontalAlignment="Center" 
                                   Width="Auto">
                            <Hyperlink Click="Click_Hyperlink">
                                <Run Text="{x:Static t:Messages.Lbl_ClickToAddImage}"/>
                            </Hyperlink>
                                    </TextBlock>
                                    <Image Stretch="None">
                                        <Image.Source>
                                            <Binding Path="Thumbnail"
                                     Converter="{StaticResource bytesToImage}">
                                                <Binding.TargetNullValue>
                                                    <ImageSource>/Probel.Ldoc.Views;component/Images/PatientData.png</ImageSource>
                                                </Binding.TargetNullValue>
                                            </Binding>
                                        </Image.Source>
                                    </Image>
                                </DockPanel>
                            </HeaderedContentControl>
                        </Border>
                        <Border DockPanel.Dock="Top" 
                                BorderThickness="5"
                                CornerRadius="5"
                                Background="#FF465A7D"
                                MinHeight="150" 
                                HorizontalAlignment="Stretch"                
                                VerticalAlignment="Top"
                                Margin="0,0,0,0">
                            <Border.Effect>
                                <DropShadowEffect Color="#FFB6B6B6"/>
                            </Border.Effect>
                            <HeaderedContentControl Header="{x:Static t:Messages.Gb_SearchTags}">
                                <DockPanel>
                                    <DockPanel DockPanel.Dock="Top">
                                        <Button x:Name="addTagBtn" DockPanel.Dock="Right"
                                            Width="20"
                                            Height="22"
                                            ToolTip="{x:Static t:Messages.Btn_AddDoctor}"
                                            Style="{StaticResource HeaderedEditionButtonStyle}"
                                            Click="Click_AddTag">
                                            <Image Source="/Probel.Ldoc.Views;component/Images/Editing/Plus.png" 
                                               Stretch="None"/>
                                        </Button>
                                        <Popup x:Name="tagPopup"
                                           Placement="Right"
                                           StaysOpen="False"
                                           PlacementTarget="{Binding ElementName=addTagBtn}"
                                           MaxHeight="250"
                                           MinWidth="250">
                                            <ListBox x:Name="tagListBox"
                                                 ItemsSource="{Binding AllSearchTags}"
                                                 SelectionChanged="Selected_TagToAdd">
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <DockPanel>
                                                            <Image Source="/Probel.Ldoc.Views;component/Images/Tag.png"
                                                               Width="24" Height="24"/>
                                                            <TextBlock Text="{Binding Name}" VerticalAlignment="Center"/>
                                                        </DockPanel>
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </Popup>
                                        <tk:WatermarkTextBox x:Name="tagBox" Watermark="{x:Static t:Messages.Watermark_AddTag}"
                                                         Margin="5,5,0,5"
                                                         KeyUp="WatermarkTextBox_KeyUp"/>
                                    </DockPanel>
                                    <ScrollViewer VerticalScrollBarVisibility="Auto">
                                        <ItemsControl ItemsSource="{Binding SearchTags}"
                                                  BorderThickness="1" BorderBrush="#FF828790">
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <DockPanel>
                                                        <Button DockPanel.Dock="Right" 
                                                                Style="{StaticResource EditionButtonStyle}"
                                                                Command="{Binding Path=RemoveCommand}">
                                                            <Image Source="/Probel.Ldoc.Views;component/Images/Delete.ico"/>
                                                        </Button>
                                                        <Image Source="/Probel.Ldoc.Views;component/Images/Tag.png"
                                                               Width="24" Height="24"/>
                                                        <TextBlock Text="{Binding Name}" VerticalAlignment="Center"/>
                                                    </DockPanel>
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                        </ItemsControl>
                                    </ScrollViewer>
                                </DockPanel>
                            </HeaderedContentControl>
                        </Border>
                        <Label/>
                    </DockPanel>
                    <ScrollViewer Grid.Column="1"
                              VerticalScrollBarVisibility="Auto">
                        <DockPanel>
                            <Border DockPanel.Dock="Top"
                                    BorderThickness="5"
                                    CornerRadius="5"
                                    Background="#FF465A7D">
                                <Border.Effect>
                                    <DropShadowEffect Color="#FFB6B6B6"/>
                                </Border.Effect>
                                <HeaderedContentControl Header="{x:Static t:Messages.Gb_Patient}">
                                    <ScrollViewer HorizontalScrollBarVisibility="Auto"
                                                  VerticalScrollBarVisibility="Disabled">
                                        <DockPanel DockPanel.Dock="Top">
                                            <DockPanel DockPanel.Dock="Top">
                                                <TextBlock Text="{x:Static t:Messages.Lbl_FirstName}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                <TextBox Text="{Binding FirstName, UpdateSourceTrigger=PropertyChanged}" KeyboardNavigation.TabIndex="0"/>
                                            </DockPanel>
                                            <DockPanel DockPanel.Dock="Top">
                                                <TextBlock Text="{x:Static t:Messages.Lbl_LastName}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                <TextBox Text="{Binding LastName, UpdateSourceTrigger=PropertyChanged}" KeyboardNavigation.TabIndex="1"/>
                                            </DockPanel>
                                            <DockPanel DockPanel.Dock="Top" LastChildFill="True">
                                                <TextBlock DockPanel.Dock="Left"
                                                       Text="{x:Static t:Messages.Lbl_Fee}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                <tk:DecimalUpDown DockPanel.Dock="Left" 
                                                      Text="{Binding Fee, UpdateSourceTrigger=PropertyChanged}"
                                                      Margin="5"
                                                      Width="90"
                                                                  KeyboardNavigation.TabIndex="2"/>
                                                <TextBlock DockPanel.Dock="Left" 
                                               Text="€"
                                               HorizontalAlignment="Left"
                                               Width="Auto"/>
                                            </DockPanel>
                                            <DockPanel DockPanel.Dock="Top"
                                           LastChildFill="False">
                                                <TextBlock Text="{x:Static t:Messages.Lbl_Birthdate}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                <DatePicker SelectedDate="{Binding Birthdate}"
                                                            Margin="5" 
                                                            FirstDayOfWeek="Monday"
                                                            KeyboardNavigation.TabIndex="3"/>
                                            </DockPanel>
                                            <DockPanel DockPanel.Dock="Top">
                                                <TextBlock Text="{x:Static t:Messages.Lbl_Pob}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                <TextBox Text="{Binding PlaceOfBirth, UpdateSourceTrigger=PropertyChanged}"
                                                         KeyboardNavigation.TabIndex="4"/>
                                            </DockPanel>
                                            <DockPanel DockPanel.Dock="Top">
                                                <TextBlock Text="{x:Static t:Messages.Lbl_Profession}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                <Button x:Name="addProfessionBtn"
                                                        DockPanel.Dock="Right"
                                                        Style="{StaticResource EditionButtonStyle}"
                                                        Click="Click_AddProfession">
                                                    <Image Source="/Probel.Ldoc.Views;component/Images/Editing/Plus.png"/>
                                                </Button>
                                                <Popup x:Name="professionPopup"
                                                       PlacementTarget="{Binding ElementName=addProfessionBtn}">
                                                    <ctrl:TextPopupView x:Name="professionContent"/>
                                                </Popup>
                                                <ComboBox ItemsSource="{Binding Professions}"
                                                          SelectedItem="{Binding SelectedProfession}"
                                                          DisplayMemberPath="Name"
                                                          IsEditable="True"
                                                          KeyboardNavigation.TabIndex="5"/>
                                            </DockPanel>
                                            <DockPanel DockPanel.Dock="Top">
                                                <TextBlock Text="{x:Static t:Messages.Lbl_Insurance}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                <Button x:Name="addInsuranceBtn" 
                                                    DockPanel.Dock="Right"
                                                    Style="{StaticResource EditionButtonStyle}"
                                                    Click="Click_AddInsurance">
                                                    <Image Source="/Probel.Ldoc.Views;component/Images/Editing/Plus.png"/>
                                                </Button>
                                                <Popup x:Name="insurancePopup"
                                                       PlacementTarget="{Binding ElementName=addInsuranceBtn}">
                                                    <ctrl:LocalisedItemPopupView x:Name="insuranceContent"/>
                                                </Popup>
                                                <ComboBox ItemsSource="{Binding Insurances}"
                                                          SelectedItem="{Binding SelectedInsurance}"
                                                          DisplayMemberPath="Name"
                                                          IsEditable="True"
                                                          KeyboardNavigation.TabIndex="6"/>
                                            </DockPanel>
                                            <DockPanel DockPanel.Dock="Top">
                                                <TextBlock Text="{x:Static t:Messages.Lbl_Practice}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                <Button x:Name="addPracticeBtn" DockPanel.Dock="Right"
                                                    Style="{StaticResource EditionButtonStyle}"
                                                    Click="Click_AddPractice">
                                                    <Image Source="/Probel.Ldoc.Views;component/Images/Editing/Plus.png"/>
                                                </Button>
                                                <Popup x:Name="practicePopup"
                                                       PlacementTarget="{Binding ElementName=addPracticeBtn}">
                                                    <ctrl:LocalisedItemPopupView x:Name="practiceContent"/>
                                                </Popup>
                                                <ComboBox ItemsSource="{Binding Practices}"
                                                          SelectedItem="{Binding SelectedPractice}"
                                                          DisplayMemberPath="Name"
                                                          IsEditable="True"
                                                          KeyboardNavigation.TabIndex="7"/>
                                            </DockPanel>
                                        </DockPanel>
                                    </ScrollViewer>
                                </HeaderedContentControl>
                            </Border>

                            <Border DockPanel.Dock="Top"
                                    BorderThickness="5"
                                    CornerRadius="5"
                                    Background="#FF465A7D">
                                <Border.Effect>
                                    <DropShadowEffect Color="#FFB6B6B6"/>
                                </Border.Effect>
                                <HeaderedContentControl Header="{x:Static t:Messages.Gb_Address}">
                                    <ScrollViewer HorizontalScrollBarVisibility="Auto"
                                                  VerticalScrollBarVisibility="Disabled">
                                        <StackPanel>
                                            <DockPanel DockPanel.Dock="Top">
                                                <TextBlock DockPanel.Dock="Left" Text="{x:Static t:Messages.Lbl_Street}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                <TextBox DockPanel.Dock="Right" Text="{Binding Street, UpdateSourceTrigger=PropertyChanged}"
                                                         KeyboardNavigation.TabIndex="8"/>
                                            </DockPanel>
                                            <Grid DockPanel.Dock="Top">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition/>
                                                    <ColumnDefinition/>
                                                </Grid.ColumnDefinitions>
                                                <DockPanel>
                                                    <TextBlock Text="{x:Static t:Messages.Lbl_StreetNumber}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                    <TextBox Text="{Binding StreetNumber, UpdateSourceTrigger=PropertyChanged}"
                                                             KeyboardNavigation.TabIndex="9"/>
                                                </DockPanel>
                                                <DockPanel Grid.Column="1">
                                                    <TextBlock Text="{x:Static t:Messages.Lbl_BoxNumber}" Width="Auto"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                    <TextBox Text="{Binding BoxNumber, UpdateSourceTrigger=PropertyChanged}" 
                                                             KeyboardNavigation.TabIndex="10"/>
                                                </DockPanel>
                                            </Grid>
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition/>
                                                    <ColumnDefinition/>
                                                </Grid.ColumnDefinitions>
                                                <DockPanel>
                                                    <TextBlock Text="{x:Static t:Messages.Lbl_PostalCode}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                    <TextBox Text="{Binding PostalCode, UpdateSourceTrigger=PropertyChanged}"
                                                             KeyboardNavigation.TabIndex="11"/>
                                                </DockPanel>
                                                <DockPanel Grid.Column="1">
                                                    <TextBlock Text="{x:Static t:Messages.Lbl_City}" Width="Auto"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                    <TextBox Text="{Binding City, UpdateSourceTrigger=PropertyChanged}"
                                                             KeyboardNavigation.TabIndex="12"/>
                                                </DockPanel>
                                            </Grid>
                                        </StackPanel>
                                    </ScrollViewer>
                                </HeaderedContentControl>
                            </Border>

                            <Border DockPanel.Dock="Top"
                                    BorderThickness="5"
                                    CornerRadius="5"
                                    Background="#FF465A7D">
                                <Border.Effect>
                                    <DropShadowEffect Color="#FFB6B6B6"/>
                                </Border.Effect>
                                <HeaderedContentControl Header="{x:Static t:Messages.Gb_Contact}">
                                    <ScrollViewer HorizontalScrollBarVisibility="Auto"
                                                  VerticalScrollBarVisibility="Disabled">
                                        <StackPanel>
                                            <GroupBox Header="{x:Static t:Messages.Gb_Private}">
                                                <StackPanel>
                                                    <DockPanel DockPanel.Dock="Top">
                                                        <TextBlock Text="{x:Static t:Messages.Lbl_Phone}"
                                                                   Style="{StaticResource TextBoxStyle}"/>
                                                        <TextBox Text="{Binding PrivatePhone, UpdateSourceTrigger=PropertyChanged}"
                                                                 KeyboardNavigation.TabIndex="13"/>
                                                    </DockPanel>
                                                    <DockPanel DockPanel.Dock="Top">
                                                        <TextBlock Text="{x:Static t:Messages.Lbl_Mobile}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                        <TextBox Text="{Binding PrivateMobile, UpdateSourceTrigger=PropertyChanged}"
                                                                 KeyboardNavigation.TabIndex="14"/>
                                                    </DockPanel>
                                                    <DockPanel DockPanel.Dock="Top">
                                                        <TextBlock Text="{x:Static t:Messages.Lbl_Email}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                        <TextBox Text="{Binding PrivateMail, UpdateSourceTrigger=PropertyChanged}"
                                                                 KeyboardNavigation.TabIndex="15"/>
                                                    </DockPanel>
                                                </StackPanel>
                                            </GroupBox>

                                            <GroupBox Header="{x:Static t:Messages.Gb_Professinal}">
                                                <StackPanel>
                                                    <DockPanel DockPanel.Dock="Top">
                                                        <TextBlock Text="{x:Static t:Messages.Lbl_Phone}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                        <TextBox Text="{Binding ProPhone, UpdateSourceTrigger=PropertyChanged}"
                                                                 KeyboardNavigation.TabIndex="16"/>
                                                    </DockPanel>
                                                    <DockPanel DockPanel.Dock="Top">
                                                        <TextBlock Text="{x:Static t:Messages.Lbl_Mobile}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                        <TextBox Text="{Binding ProMobile, UpdateSourceTrigger=PropertyChanged}"
                                                                 KeyboardNavigation.TabIndex="17"/>
                                                    </DockPanel>
                                                    <DockPanel DockPanel.Dock="Top">
                                                        <TextBlock Text="{x:Static t:Messages.Lbl_Email}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                                        <TextBox Text="{Binding ProMail, UpdateSourceTrigger=PropertyChanged}"
                                                                 KeyboardNavigation.TabIndex="18"/>
                                                    </DockPanel>
                                                </StackPanel>
                                            </GroupBox>
                                        </StackPanel>
                                    </ScrollViewer>
                                </HeaderedContentControl>
                            </Border>

                            <Border DockPanel.Dock="Top"
                                    BorderThickness="5"
                                    CornerRadius="5"
                                    Background="#FF465A7D">
                                <Border.Effect>
                                    <DropShadowEffect Color="#FFB6B6B6"/>
                                </Border.Effect>
                                <HeaderedContentControl Header="{x:Static t:Messages.Gb_Misc}">
                                    <StackPanel>
                                        <DockPanel DockPanel.Dock="Top"
                                       LastChildFill="False">
                                            <TextBlock Text="{x:Static t:Messages.Lbl_Inscription}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                            <DatePicker SelectedDate="{Binding InscriptionDate}"
                                                        Margin="5"/>
                                        </DockPanel>
                                        <DockPanel DockPanel.Dock="Top">
                                            <TextBlock Text="{x:Static t:Messages.Lbl_Reputation}"
                                                       Style="{StaticResource TextBoxStyle}"/>
                                            <Button x:Name="addReputationBtn"
                                                    DockPanel.Dock="Right"
                                                    Style="{StaticResource EditionButtonStyle}"
                                                    Click="Click_AddReputation">
                                                <Image Source="/Probel.Ldoc.Views;component/Images/Editing/Plus.png"/>
                                            </Button>
                                            <Popup x:Name="reputationPopup"                                                  
                                                   PlacementTarget="{Binding ElementName=addReputationBtn}">
                                                <ctrl:TextPopupView x:Name="reputationContent"/>
                                            </Popup>
                                            <ComboBox ItemsSource="{Binding Reputations}"
                                                      SelectedItem="{Binding SelectedReputation}"
                                                      DisplayMemberPath="Name"
                                                      IsEditable="True"
                                                      KeyboardNavigation.TabIndex="19"/>
                                        </DockPanel>
                                    </StackPanel>
                                </HeaderedContentControl>
                            </Border>
                            <TextBlock/>
                        </DockPanel>
                    </ScrollViewer>
                    <DockPanel Grid.Column="2">
                        <Border DockPanel.Dock="Top"
                            BorderThickness="5"
                            CornerRadius="5"
                            Background="#FF465A7D">
                            <Border.Effect>
                                <DropShadowEffect Color="#FFB6B6B6"/>
                            </Border.Effect>
                            <HeaderedContentControl Header="{x:Static t:Messages.Gb_Doctors}"
                                                Height="300">
                                <DockPanel>
                                    <StackPanel DockPanel.Dock="Top"
                                            Orientation="Horizontal">
                                        <Button x:Name="addDoctorBtn" ToolTip="{x:Static t:Messages.Btn_AddDoctor}"
                                                Style="{StaticResource HeaderedEditionButtonStyle}"
                                                Click="Click_AddDoctor">
                                            <StackPanel Orientation="Horizontal">
                                                <Image Source="/Probel.Ldoc.Views;component/Images/Editing/Plus.png" 
                                                   Height="20" Width="20" Stretch="None"/>
                                                <TextBlock Text="{x:Static t:Messages.Btn_AddDoctor}" 
                                                       Width="Auto"
                                                       VerticalAlignment="Center"/>
                                            </StackPanel>
                                        </Button>
                                        <Popup x:Name="doctorPopup"
                                               PlacementTarget="{Binding ElementName=addDoctorBtn}">
                                            <ctrl:DoctorPopupView x:Name="doctorContent"/>
                                        </Popup>
                                    </StackPanel>
                                    <ScrollViewer VerticalScrollBarVisibility="Auto"
                                          HorizontalScrollBarVisibility="Auto">
                                        <ItemsControl ItemsSource="{Binding Doctors}"
                                                  BorderThickness="1" BorderBrush="#FF828790">
                                            <ItemsControl.ItemTemplate>
                                                <DataTemplate>
                                                    <ctrl:DoctorCardEditableView/>
                                                </DataTemplate>
                                            </ItemsControl.ItemTemplate>
                                        </ItemsControl>
                                    </ScrollViewer>
                                </DockPanel>
                            </HeaderedContentControl>
                        </Border>
                        <Border DockPanel.Dock="Top"
                                BorderThickness="5"
                                CornerRadius="5"
                                Background="#FF465A7D">
                            <Border.Effect>
                                <DropShadowEffect Color="#FFB6B6B6"/>
                            </Border.Effect>
                            <HeaderedContentControl Header="{x:Static t:Messages.Gb_Notes}">
                                <TextBox Text="{Binding Reason, UpdateSourceTrigger=PropertyChanged}"
                                         Margin="4"
                                         VerticalScrollBarVisibility="Visible"
                                         HorizontalScrollBarVisibility="Auto"
                                         TextWrapping="Wrap"
                                         AcceptsReturn="True" 
                                         KeyboardNavigation.TabIndex="20"/>
                            </HeaderedContentControl>
                        </Border>
                    </DockPanel>
                </Grid>
            </DockPanel>
        </HeaderedContentControl>
    </DockPanel>
</Page>